import React, { useState } from "react";
import { useDispatch, useSelector } from "react-redux";
import actionCreators from "../store/actionCreators/counter";
function Counter() {
  const [number, setNumber] = useState(0);
  const num = useSelector((state) => state.counter.num);
  const dispatch = useDispatch();
  return (
    <div>
      <div>{number}</div>
      <div>{num}</div>
      <button onClick={() => setNumber(number + 1)}>+</button>
      <button onClick={() => dispatch(actionCreators.add())}>num+</button>
    </div>
  );
}

export default Counter;
